package main.java.tutorial.springmvc.component;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.view.AbstractView;

@Component
public class MyCustomViewResolver extends AbstractView{

	@Override
	protected void renderMergedOutputModel(
			Map<String, Object> model,
			HttpServletRequest request, 
			HttpServletResponse response)
			throws Exception {
		
		System.out.println("vista risolta da MyViewResolver");

		response.setContentType("application/xml");
	    response.setCharacterEncoding("UTF-8");
	    response.getOutputStream().print("<root><figlio1>a</figlio1><figlio2>b</figlio2></root>");
		
	}

}
